package 双指针;

/**
 * @author tmh
 * @date 2025/3/6 17:35
 * @description
 */
public class T11盛最多水的容器 {
    public int maxArea(int[] height) {
        int maxArea = 0;
        for (int i=0,j=height.length-1;i<j;){
            int minHeight = height[i]>height[j]?height[j--]:height[i++];
            int area = (j-i+1)*minHeight;
            maxArea=Math.max(maxArea,area);
        }
        return maxArea;
    }
}
